<?php
	session_start();
	ini_set("include_path", ".:../:./includes:../includes");
	extract($_REQUEST);
	require_once("includes/common.php");
	require_once("includes/constants.php");
	require_once("includes/database.php");
	$e_title = toTitleCase($e_title);
	$e_firstname = toTitleCase($e_firstname); 
	$e_surname = toTitleCase($e_surname);
	if (insertEmployee(toTitleCase($e_title), toTitleCase($e_firstname) , toTitleCase($e_surname) , strtolower($e_email) , $e_phone_no ,$e_hours_per_day) != 0) {		
		$confirmationMessage = "$e_firstname $e_surname has been added into company records." ;
		$_SESSION[EMPLOYEES] = getAllEmployees(); //update employee list in session 
		header( 'Location: confirmationPage.php?' . "confirmationMessage=" .$confirmationMessage) ;
	}
	else {
		$errorMessage = "There was been a problem adding $e_firstname $e_surname.";
		header( 'Location: errorPage.php?' . "errorMessage=" . $errorMessage ) ;
	}	
?>
